home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / clipper / ks94an.zip / APPXEQUA.HDR < prev    next >
Text File  |  1994-04-25  |  1KB  |  49 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _AppxEqual(nNum1, nNum2, nDec) --> lIsAppxEqual
  8.  
  9. PARAMETERS:
  10.  
  11. nNum1: number to compare to nNum2
  12. nNum2: number to compare to nNum1
  13. nDecs: number of decimal places to compare.
  14.  
  15. SHORT:
  16.  
  17. Determine floating point equality to a given decimal place.
  18.  
  19. DESCRIPTION:
  20.  
  21. _AppxEqual() determines if two floating point values are equal WITHIN the
  22. given number of decimal places.  This is a very common operation when dealing
  23. with comparisons of floating point numbers.
  24.  
  25. The function is useful when trying to find an acceptable equality between two
  26. floating point numbers when they can never be exactly equal (thus foiling
  27. any use of the "=" operator).
  28.  
  29. NOTE:
  30.  
  31.  
  32.  
  33. EXAMPLE:
  34.  
  35. nNum1 = 3.141592654
  36. nNum2 = 3.141592655
  37.  
  38. ? _AppxEqual(nNum1, nNum2, 9)
  39.  
  40. FALSE  the numbers are not equal to nine decimal places.
  41.  
  42.  
  43. ? _AppxEqual(nNum1, nNum2, 8)
  44.  
  45. However, they are equal to eight decimals places, so the return value is
  46. TRUE.
  47.  
  48. ******************************************************************************/
  49.